*******************************************	   
************* TABLE A10  Different networks
*******************************************	   

clear all
clear matrix
set more off

* Data
use "~/Dropbox/Replication_MVC/Datasets/datasets_analysis/panel_excombatientes.dta", clear 

// Placebo Network 1: Same Grupo Territorial Asignado
egen peacetimenetwork1 = group(GrupoTerritorialAsignado)

* create shock for peacetime network
sort peacetimenetwork1
by peacetimenetwork1: egen mean_gold_production_positive=mean(oro_sin_titulo)
gen mean_gold_shock_positive=mean_gold_production_positive*log_gold_price

* Standarize
sum mean_gold_shock_positive
generate mean_gold_shock_positive_r = (mean_gold_shock_positive-r(mean))/r(sd)

eststo clear
set more off

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_positive_r, absorb(peacetimenetwork1 year origmun) vce(cluster peacetimenetwork1)
estadd local ALLFE = "$\checkmark$"
summ diffcaptures_f if e(sample) ==1
estadd local meanDep = trim("`: display %12.4fc `r(mean)''")
estadd local SDDep = trim("`: display %12.4fc `r(sd)''")
eststo

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_positive_r age female black indigenous c.time_t##i.region c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t, absorb(peacetimenetwork1 year origmun) vce(cluster peacetimenetwork1)
estadd local ALLFE = "$\checkmark$"
estadd local TT = "$\checkmark$"
estadd local MT = "$\checkmark$"
estadd local BC = "$\checkmark$"
estadd local CO = "$\checkmark$"
summ diffcaptures_f if e(sample) ==1
estadd local meanDep = trim("`: display %12.4fc `r(mean)''")
estadd local SDDep = trim("`: display %12.4fc `r(sd)''")
eststo	

/*esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA10_panelA1.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   stats(meanDep SDDep N ALLFE TT MT BC CO, fmt(%12.4fc %12.4fc  %12.0fc %12.0fc %12.0fc %12.0fc  %12.0fc ) ///
	   label("\small Mean of Outcome" "\small S.D of Outcome" "\small Observations" "\small Municipality, Year, and Group FE" "\small Time Trends" "\small Region $\times$ Year"  ///
		"\small Municipality Characteristics TT" "\small Individual Covariates" )) ///
	   keep(gold_shock_r mean_gold_shock_positive_r) ///
	   varlabels(gold_shock_r "Economic Shock" mean_gold_shock_positive_r "Average Shock" ) ///
	   ti("Test With Different Post-conflict Network") ///	  
	   replace  */

 * For Table A31 ---- same below for Table A32
//       esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA31.tex", se ///
//	   star(* 0.10 ** 0.05 *** 0.01 ) ///
//	   stats(meanDep SDDep N ALLFE TT MT BC CO, fmt(%12.4fc %12.4fc  %12.0fc %12.0fc %12.0fc %12.0fc  %12.0fc ) ///
//	   label("\small Mean of Outcome" "\small S.D of Outcome" "\small Observations" "\small Municipality, Year, and Group FE" "\small Time Trends" "\small Region $\times$ Year"  ///
//		"\small Municipality Characteristics TT" "\small Individual Covariates" )) ///
// varlabels(gold_shock_r "Economic Shock" mean_gold_shock_positive_r "Average Shock" ) ///
//	   ti("Test With Different Post-conflict Network") ///	  
//   replace  

   
eststo clear
set more off

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_positive_r, absorb(peacetimenetwork1 year origmun) vce(cluster peacetimenetwork1)
nlcom _b[mean_gold_shock_positive_r]/(_b[gold_shock_r] + _b[mean_gold_shock_positive_r]), post
eststo

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_positive_r age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t, absorb(peacetimenetwork1 year origmun c.time_t##i.region ) vce(cluster peacetimenetwork1)
nlcom _b[mean_gold_shock_positive_r]/(_b[gold_shock_r] + _b[mean_gold_shock_positive_r]), post
eststo

/*esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA10_panelB1.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   stats(meanDep N, fmt(%12.4fc %12.0fc)) ///
	   keep(_nl_1 ) ///
	   varlabels( _nl_1 "Peer Effect") ///
	   ti("Economic Shock and Peer Effects - Peacetime Network 1") ///	  
	   replace	   */
	   
// Placebo Network 2: Same Grupo Territorial Asignado and same Region
egen peacetimenetwork2 = group(GrupoTerritorialAsignado region)

* create shock for peacetime network
sort peacetimenetwork2
by peacetimenetwork2: egen mean_gold_production_positive2=mean(oro_sin_titulo)
gen mean_gold_shock_positive2=mean_gold_production_positive2*log_gold_price

* Standarize
sum mean_gold_shock_positive2
generate mean_gold_shock_positive_r2 = (mean_gold_shock_positive2-r(mean))/r(sd)

eststo clear
set more off

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_positive_r2, absorb(peacetimenetwork2 year origmun) vce(cluster peacetimenetwork2)
estadd local ALLFE = "$\checkmark$"
summ diffcaptures_f if e(sample) ==1
estadd local meanDep = trim("`: display %12.4fc `r(mean)''")
estadd local SDDep = trim("`: display %12.4fc `r(sd)''")
eststo

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_positive_r2 age female black indigenous c.time_t##i.region c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t, absorb(peacetimenetwork2 year origmun ) vce(cluster peacetimenetwork2)
estadd local ALLFE = "$\checkmark$"
estadd local TT = "$\checkmark$"
estadd local MT = "$\checkmark$"
estadd local BC = "$\checkmark$"
estadd local CO = "$\checkmark$"
summ diffcaptures_f if e(sample) ==1
estadd local meanDep = trim("`: display %12.4fc `r(mean)''")
estadd local SDDep = trim("`: display %12.4fc `r(sd)''")
eststo

//esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA10_panelA2.tex", se ///
//	   star(* 0.10 ** 0.05 *** 0.01 ) ///
//	   stats(meanDep SDDep N ALLFE TT MT BC CO, fmt(%12.4fc %12.4fc  %12.0fc %12.0fc %12.0fc %12.0fc  %12.0fc ) ///
//	 label("\small Mean of Outcome" "\small S.D of Outcome" "\small Observations" "\small Municipality, Year, and Group FE" "\small Time Trends" "\small Region $\times$ Year"  ///
//		"\small Municipality Characteristics TT" "\small Individual Covariates" )) ///
//	   varlabels(gold_shock_r "Economic Shock" mean_gold_shock_positive_r2 "Average Shock" ) ///
//	   ti("Test With Different Post-conflict Network 2") ///	  
//	   replace 
	   
 esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA32.tex", se ///
 	   star(* 0.10 ** 0.05 *** 0.01 ) ///
 	   stats(meanDep SDDep N ALLFE TT MT BC CO, fmt(%12.4fc %12.4fc  %12.0fc %12.0fc %12.0fc %12.0fc  %12.0fc ) ///
 	 label("\small Mean of Outcome" "\small S.D of Outcome" "\small Observations" "\small Municipality, Year, and Group FE" "\small Time Trends" "\small Region $\times$ Year"  ///
 		"\small Municipality Characteristics TT" "\small Individual Covariates" )) ///
 	   varlabels(gold_shock_r "Economic Shock" mean_gold_shock_positive_r2 "Average Shock" ) ///
 	   ti("Test With Different Post-conflict Network 2") ///	  
 	   replace 
/*	   
eststo clear
set more off

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_positive_r2, absorb(peacetimenetwork2 year origmun) vce(cluster peacetimenetwork2)
nlcom _b[mean_gold_shock_positive_r2]/(_b[gold_shock_r] + _b[mean_gold_shock_positive_r2]), post
eststo

reghdfe diffcaptures_f gold_shock_r mean_gold_shock_positive_r2 age female black indigenous c.pobreza##c.time_t c.pobl_tot##c.time_t c.disbogota##c.time_t c.paved_roads##c.time_t, absorb(peacetimenetwork2 year origmun c.time_t##i.region ) vce(cluster peacetimenetwork2)
nlcom _b[mean_gold_shock_positive_r2]/(_b[gold_shock_r] + _b[mean_gold_shock_positive_r2]), post
eststo

esttab est* using "~/Dropbox/Replication_MVC/Paper_tables/TableA10_panelB2.tex", se ///
	   star(* 0.10 ** 0.05 *** 0.01 ) ///
	   stats(meanDep N, fmt(%12.4fc %12.0fc)) ///
	   keep(_nl_1 ) ///
	   varlabels( _nl_1 "Peer Effect") ///
	   replace	   
	   
* Both peacetime network results go in the same table - organized vertically 
